package com.warmheart.builder.access;

import com.warmheart.core.co.base.BaseCoBuilder;
import com.warmheart.core.co.oper.Co;
import com.warmheart.core.cors.enums.DateFormatEnum;
import com.warmheart.entity.access.AccessRequest;

/**
 * 
 * @ClassName: AccessRequest
 * @Description: 权限申请实体CoBuilder类，对应表名称为tb_access_request
 *               温馨提示：不要修改该实体CoBuilder类的任何字段
 * @author ZhangJianyang
 * @date 2025年06月16日 下午13:05:35
 *
 */
public class AccessRequestCoBuilder extends BaseCoBuilder<AccessRequest, AccessRequestCoBuilder> {

    private final AccessRequest t;

    @Override
    protected AccessRequestCoBuilder self() {
        return this;
    }

    @Override
    public AccessRequest core() {
        return this.t;
    }

    public AccessRequestCoBuilder(AccessRequest accessRequest) {
        t = accessRequest;
    }

    /**
     * 申请人ID
     */
    private Co<AccessRequest, AccessRequestCoBuilder> applicantId;

    /**
     * 资源类型
     */
    private Co<AccessRequest, AccessRequestCoBuilder> resourceType;

    /**
     * 资源ID
     */
    private Co<AccessRequest, AccessRequestCoBuilder> resourceId;

    /**
     * 访问类型
     */
    private Co<AccessRequest, AccessRequestCoBuilder> accessType;

    /**
     * 申请理由
     */
    private Co<AccessRequest, AccessRequestCoBuilder> reason;

    /**
     * 审批状态
     */
    private Co<AccessRequest, AccessRequestCoBuilder> state;

    /**
     * 审批意见
     */
    private Co<AccessRequest, AccessRequestCoBuilder> reviewComment;

    /**
     * 过期时间(临时权限)
     */
    private Co<AccessRequest, AccessRequestCoBuilder> expiresTime;

    public Co<AccessRequest, AccessRequestCoBuilder> applicantId() {
        if (this.applicantId == null) {
            this.applicantId = new Co<AccessRequest, AccessRequestCoBuilder>(self(), "applicant_id");
        }
        return this.applicantId;
    }

    public Co<AccessRequest, AccessRequestCoBuilder> resourceType() {
        if (this.resourceType == null) {
            this.resourceType = new Co<AccessRequest, AccessRequestCoBuilder>(self(), "resource_type");
        }
        return this.resourceType;
    }

    public Co<AccessRequest, AccessRequestCoBuilder> resourceId() {
        if (this.resourceId == null) {
            this.resourceId = new Co<AccessRequest, AccessRequestCoBuilder>(self(), "resource_id");
        }
        return this.resourceId;
    }

    public Co<AccessRequest, AccessRequestCoBuilder> accessType() {
        if (this.accessType == null) {
            this.accessType = new Co<AccessRequest, AccessRequestCoBuilder>(self(), "access_type");
        }
        return this.accessType;
    }

    public Co<AccessRequest, AccessRequestCoBuilder> reason() {
        if (this.reason == null) {
            this.reason = new Co<AccessRequest, AccessRequestCoBuilder>(self(), "reason");
        }
        return this.reason;
    }

    public Co<AccessRequest, AccessRequestCoBuilder> state() {
        if (this.state == null) {
            this.state = new Co<AccessRequest, AccessRequestCoBuilder>(self(), "state");
        }
        return this.state;
    }

    public Co<AccessRequest, AccessRequestCoBuilder> reviewComment() {
        if (this.reviewComment == null) {
            this.reviewComment = new Co<AccessRequest, AccessRequestCoBuilder>(self(), "review_comment");
        }
        return this.reviewComment;
    }

    public Co<AccessRequest, AccessRequestCoBuilder> expiresTime(DateFormatEnum... dateFormatEnums) {
        if (this.expiresTime == null) {
            if (dateFormatEnums != null && dateFormatEnums.length > 0) {
                this.expiresTime = new Co<AccessRequest, AccessRequestCoBuilder>(self(), "expires_time",
                        dateFormatEnums[0].getValue());
            } else {
                this.expiresTime = new Co<AccessRequest, AccessRequestCoBuilder>(self(), "expires_time",
                        DateFormatEnum.yyyy_MM_dd.getValue());
            }
        }
        return this.expiresTime;
    }
}